package com.engr.domain;

import com.engr.annotation.FieldInfo;
import lombok.Data;
import org.hibernate.annotations.ColumnDefault;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;

/**
 * @program: train-project
 * @description: member
 * @author: lyx
 * @create: 2018-11-01
 **/
@Data
@Entity
@Table(name = "member")
public class Member implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    protected Long id = 0L;
    @NotEmpty
    @Column(length = 64, nullable = false, unique = true)
    @ColumnDefault("'' COMMENT '登录的uuid'")
    private String username;

    private String password;

    @ColumnDefault("'' COMMENT '真实姓名'")
    @FieldInfo("真实姓名")
    private String realname;

    @FieldInfo("昵称")
    private String nickname;

    @FieldInfo("默认头像地址")
    private String avatar;//= SysConsts.DEFAULT_AVATAR_URL;

    @Column(length = 64)
    @FieldInfo("QQ号")
    private String qq;

    private String qqOpenid;

    @Column(length = 64)
    @FieldInfo("微信号")
    private String wechat;

    private String wechatOpenid;

    @Column(length = 64)
    @FieldInfo("微博账号")
    private String weibo;
    private String weiboOpenid;
    @Column(length = 32)
    @Email
    @FieldInfo("邮箱")
    private String email;

    private boolean emailConfirmed;

    private boolean receieveNotify = false;

    @Column(length = 16)
    @FieldInfo("手机号")
    private String phone;

    @Column(length = 8)
    @ColumnDefault("'保密' COMMENT '性别：男，女，保密'")
    private String gender = "保密";

    @Past
    @Temporal(TemporalType.DATE)
    @FieldInfo("生日")
    private Date birthday;

    private Date lastLoginTime;

    private Date lastPasswordReset;
}
